Remove redundant size checks, and document that width, height must be > 0.
authorMatthias Clasen <mclasen@redhat.com>
Thu, 21 Dec 2006 20:40:24 +0000 (20:40 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Thu, 21 Dec 2006 20:40:24 +0000 (20:40 +0000)
2006-12-21  Matthias Clasen  <mclasen@redhat.com>

        * gdk-pixbuf-data.c (gdk_pixbuf_new_from_data):
        * gdk-pixbuf.c (gdk_pixbuf_new): Remove redundant size
        checks, and document that width, height must be > 0.
        (#343330, Felix Riemann)

gdk-pixbuf/ChangeLog
gdk-pixbuf/gdk-pixbuf-data.c
gdk-pixbuf/gdk-pixbuf.c

index f2a3f2cbc64b5db399a3346a8182d1aaed0315d5..fc9901034056bf5c476b4abd68b346e8a38bd453 100644 (file)
@@ -1,5 +1,10 @@
 2006-12-21  Matthias Clasen  <mclasen@redhat.com>
 
+       * gdk-pixbuf-data.c (gdk_pixbuf_new_from_data):
+       * gdk-pixbuf.c (gdk_pixbuf_new): Remove redundant size
+       checks, and document that width, height must be > 0.
+       (#343330, Felix Riemann)
+
        * Makefile.am: Link against GLib.  (#341158, Alexey Rusakov)
 
 2006-12-19  Matthias Clasen  <mclasen@redhat.com>
index 43fd9c1d3df12e2c61b230ba68a3cecf6d61c07f..16b7d9b97a7c7bad7350346c0f52550ea0e5302b 100644 (file)
 
 /**
  * gdk_pixbuf_new_from_data:
- * @data: Image data in 8-bit/sample packed format.
- * @colorspace: Colorspace for the image data.
- * @has_alpha: Whether the data has an opacity channel.
- * @bits_per_sample: Number of bits per sample.
- * @width: Width of the image in pixels.
- * @height: Height of the image in pixels.
- * @rowstride: Distance in bytes between row starts.
+ * @data: Image data in 8-bit/sample packed format
+ * @colorspace: Colorspace for the image data
+ * @has_alpha: Whether the data has an opacity channel
+ * @bits_per_sample: Number of bits per sample
+ * @width: Width of the image in pixels, must be > 0
+ * @height: Height of the image in pixels, must be > 0
+ * @rowstride: Distance in bytes between row starts
  * @destroy_fn: Function used to free the data when the pixbuf's reference count
- * drops to zero, or %NULL if the data should not be freed.
- * @destroy_fn_data: Closure data to pass to the destroy notification function.
+ * drops to zero, or %NULL if the data should not be freed
+ * @destroy_fn_data: Closure data to pass to the destroy notification function
  * 
  * Creates a new #GdkPixbuf out of in-memory image data.  Currently only RGB
  * images with 8 bits per sample are supported.
index 42c91887b567a2aedd36d6b58ab74aa42f49d35f..a582733229fac80a5722d4f82989fdc3a3b5a95b 100644 (file)
@@ -224,11 +224,11 @@ free_buffer (guchar *pixels, gpointer data)
 
 /**
  * gdk_pixbuf_new:
- * @colorspace: Color space for image.
- * @has_alpha: Whether the image should have transparency information.
- * @bits_per_sample: Number of bits per color sample.
- * @width: Width of image in pixels.
- * @height: Height of image in pixels.
+ * @colorspace: Color space for image
+ * @has_alpha: Whether the image should have transparency information
+ * @bits_per_sample: Number of bits per color sample
+ * @width: Width of image in pixels, must be > 0
+ * @height: Height of image in pixels, must be > 0
  *
  * Creates a new #GdkPixbuf structure and allocates a buffer for it.  The 
  * buffer has an optimal rowstride.  Note that the buffer is not cleared;
@@ -254,9 +254,6 @@ gdk_pixbuf_new (GdkColorspace colorspace,
        g_return_val_if_fail (width > 0, NULL);
        g_return_val_if_fail (height > 0, NULL);
 
-        if (width <= 0 || height <= 0)
-                return NULL;
-
        channels = has_alpha ? 4 : 3;
         rowstride = width * channels;
         if (rowstride / channels != width || rowstride + 3 < 0) /* overflow */